package com.zby.filter.vo.enums;

import java.util.HashMap;
import java.util.Map;

/**
 * Created By zby on 17:46 2019/1/30
 */

public enum AddressTagEnum implements TitleEnum {

    ADDRESS_TAG_HOME("家"),
    ADDRESS_TAG_COMPANY("公司"),
    ADDRESS_TAG_SCHOOL("学校");

    private String title;


    AddressTagEnum(String title) {
        this.title = title;
    }

    @Override
    public String getTitle() {
        return title;
    }

    public static AddressTagEnum getByEnumName(final Object enumName) {
        for (AddressTagEnum AddressTagEnum : AddressTagEnum.class.getEnumConstants()) {
            if (AddressTagEnum.equals(enumName))
                return AddressTagEnum;
        }
        return null;
    }

    public static Map<String, String> getName2TitleMap() {
        Map<String, String> map = new HashMap<>();
        for (AddressTagEnum AddressTagEnum : AddressTagEnum.class.getEnumConstants()) {
            map.put(AddressTagEnum.name(), AddressTagEnum.title);
        }
        return map;
    }

}
